class Solution:
    def isPossible(self, nums) -> bool:
        mapper={}
        prev=nums[0]
        symbol=[0 for i in range(nums[-1]-nums[0]+1)]
        for i in nums:
            symbol[i-nums[0]]+=1
        offset=0
        #print(symbol)
        while offset<len(symbol):
            count=0
            for i in range(offset,len(symbol)):
                if symbol[i]<=symbol[i-1] and count>=3:
                    break
                elif symbol[i]==0:
                    break
                else:
                    symbol[i]-=1
                    count+=1
                    if symbol[i]==0:
                        offset=i+1
            #print(count)
            if count==0:
                offset+=1
            elif count<3:
                return False
        #print(symbol)
        if sum(symbol)!=0:
            return False
        return True
            
s=Solution()
print(s.isPossible([1,2,3,4,4,5]))


'''
执行用时：
152 ms
, 在所有 Python3 提交中击败了
55.48%
的用户
内存消耗：
14.5 MB
, 在所有 Python3 提交中击败了
77.51%
的用户
'''